using System;
using UnityEngine;

namespace Flaschengeist.Views 
{
	public class ErrorView : BaseView
	{
		private Exception e;
		
		public void Show(Exception e)
		{
			this.e = e;
			base.Show();
		}
		
		public void OnGUI()
		{
			if (IsActive)
			{
				var errorString = string.Format(
					"Sorry! Unexpected error occurred!\nDetails:\nMessage:{0}\nStacktrace:{1}\nSource:{2}", 
					e.Message,
					e.StackTrace,
					e.Source);
				
				GUI.Box(new Rect(Screen.width/2 - 200, Screen.height/2 - 200, 400, 400), "Error");
				GUI.TextField(new Rect(Screen.width/2 - 175, Screen.height/2 - 150, 350, 300), errorString); 
			}
		}
	}
}

